﻿<ValidateForm Model=model OnInvalidSubmit="@OnInvalidSubmit">

    <ModalTemplate>
        <ModalBodyTemplate>
            <Button Text="子窗体" OnClick="asdf"> </Button>
        </ModalBodyTemplate>
        <ModalFooterTemplate>
            <Button Text="提交"></Button>
        </ModalFooterTemplate>
    </ModalTemplate>
</ValidateForm>


@code {

    [Parameter]
    public string Title { set; get; }

    [Inject]
    ModalService modalService { set; get; }

    private SaleOrderListModel model { set; get; } = new SaleOrderListModel();

    private async Task asdf()
    {
        ModalOption option = new ModalOption();
        option.Title = DateTime.Now.ToString();
        option.Width = 700;
        option.BodyTemplate = builder =>
            {
                var index = 0;
                Dictionary<string, object> parameters = new Dictionary<string, object>();
                parameters.Add(nameof(TestModal.Title), DateTime.Now.ToString());
                var component = BootstrapDynamicComponent.CreateComponent<TestModal>(parameters);
                builder.AddContent(index, component.Render());
            };

        modalService.Show(option);
    }

    private async Task OnInvalidSubmit(EditContext context)
    {

        await Task.CompletedTask;
    }
}
